import java.util.HashMap;
import java.util.HashSet;

public class Map {
    public int num(String jewels, String stone) {

        HashSet<Character> hashMap = new HashSet<>();
        for (int i = 0; i < jewels.length(); i++) {
            hashMap.add(jewels.charAt(i));
        }
        int count = 0;
        for (int i = 0; i < stone.length(); i++) {
            if (hashMap.contains(stone.charAt(i))) {
                count++;
            }
        }
        return count;
    }

    public static void main(String[] args) {

    }
}
